package yxy.cherry.battle.module.affix.skill;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixContext;
import yxy.cherry.battle.module.affix.AffixContext.AffixTarget;
import yxy.cherry.battle.module.affix.AffixFactory.SkillTypeEnum;
import yxy.cherry.battle.module.affix.Skill;
import yxy.cherry.battle.module.affix.SkillType;
import yxy.cherry.data.bean.skill;

import java.util.ArrayList;

/** 增伤 */
@SkillType(Type = SkillTypeEnum.增伤)
public class Affix_14_增伤 extends Skill {

	private int get增伤比例() {
		return getParam(0);
	}

	public Affix_14_增伤(Fighter actor, skill skilldata, int probability, int[] params) {
		super(actor, skilldata, probability, params);
	}

	@Override
	public boolean exec(Fighter actor, Fighter target) {
		AffixContext.AffixAction affixAction = getAffixAction();

		if(target.equals(affixAction.get针对目标())) {
			AffixTarget affixTarget = affixAction.getTarget(target);

			ArrayList<Long> 伤害流 = affixTarget.get伤害流();
			ArrayList<Long> 结算伤害流 = genFinalDamage(伤害流, affixTarget.getBaseDamageList(), get增伤比例());

			Battle.battleLogger(6,"技能增伤：施法者：" + actor.getName() + "对象：" + affixTarget.get目标().getName() + "原始伤害：" + 伤害流.toString() +"基础伤害："+affixTarget.getBaseDamageList().toString()+ "增伤：" + 结算伤害流.toString());
			affixTarget.set伤害流(结算伤害流);

		}

		return true;
	}

}